//
//  Define.h
//  CarUser
//
//  Created by 王森林 on 2018/11/30.
//  Copyright © 2018年 王森林. All rights reserved.
//

#ifndef Define_h
#define Define_h


// RGB颜色
#define RGB(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
#define KRGB(r, g, b,f) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:f]
//图片
#define IMG(name) [UIImage imageNamed:name]

#define IMGWIDTH(image) image.size.width

#define IMGHEIGHT(image) image.size.height

#define BOUNDWIDTH [UIScreen mainScreen].bounds.size.width

#define BOUNDHEIGHT [UIScreen mainScreen].bounds.size.height

#define kMarginLeft 15.0f

#define kMarginRight 15.0f


#define CWeakSelf __weak typeof(self) weakSelf = self



//系统版本
#define IOS_VERSION [UIDevice currentDevice].systemVersion.doubleValue
// Window实例
#define WINDOW ([[UIApplication sharedApplication] keyWindow])
// AppDelegate
#define GetAppDelegate AppDelegate * appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]
#define GetKeyWindow [UIApplication sharedApplication].keyWindow
#define GetAppRootViewController ((AppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController

#define NAV_HEIGHT (IS_IPHONE_X?88:64)//导航栏+状态栏高度
#define TABBAR_HEIGHT (IS_IPHONE_X?83:49)//tabBar高度+小白条



//转字符串
#define TO_STR(A) [NSString stringWithFormat:@"%@",A]






//项目共用颜色
#define Common_NavigroundColor RGB(50, 50, 50)             //#fe4c34
#define Common_BackgroundColor RGB(250, 250, 250)             //#
#define Common_BackgroundGrayColor KRGB(244,247,248,1)          //#
#define Common_SepeColor KRGB(195,195,195,0.6)                   //EAEAEA 用于分割线与背景
#define Common_TextColor RGB(40, 40, 40)                      //#333333用于文字信息
#define Common_TextLowColor RGB(195,195,195)               //999999
#define Common_Text_BlackColor RGB(0,0,0)           //#000000 用于导航栏标题
#define Common_Text_TextfieldColor RGB(152,152,152)           //#C7C7C7 用于输入框提示（或用系统颜色）
#define Common_Text_WhiteColor RGB(255,255,255)           //白色
#define Common_Head_Color RGB(243,243,243)           //tablview head 颜色
#define Common_HeadTitle_Color RGB(68,68,68)           //tablview head  title 颜色

#define Common_TextColor2 RGB(64,61,68)
#define Common_BG_yellow RGB(255,221,61)



#define SCALE_DEF_WITH_SCAL ([UIScreen mainScreen].bounds.size.width / 375.0f)
#define SCALE_DEF_HEIGHT_SCAL (([UIScreen mainScreen].bounds.size.height <=736.0f?[UIScreen mainScreen].bounds.size.height:736.0f )/ 667.0f)

#define SCALE_WIDTH(A) ([UIScreen mainScreen].bounds.size.width == 375.0f ? (1 * A):(SCALE_DEF_WITH_SCAL * A))
#define SCALE_HEIGHT(A) ([UIScreen mainScreen].bounds.size.width == 375.0f ? (1 * A):(SCALE_DEF_HEIGHT_SCAL * A))




//导航栏默认图片创建  高度为64
//#define Common_NavBgImgv [CommonMethod coreGraphicsColorGradualchange:CGSizeMake(SCREEN_WIDTH, 64) fromColor:RGB(255, 109, 92, 1) toColor:RGB(254, 65, 44, 1)]
#define Common_NavBgImgv [CommonMethod createImageWithColor:Common_NavigroundColor WithFrame:CGRectMake(0, 0, BOUNDWIDTH, IS_IPHONE_X?88:64)]

#define FONT_SIZE(A) [UIFont fontWithName:NORMAL_FONT_NAME size:(IS_IPHONE_4_4s||IS_IPHONE_5_5s_5c)?(A-1):((IS_IPHONE_6p_6sp_7p_8p)?(A+1):A)]

#define B_FONT_SIZE(A) [UIFont fontWithName:BLOD_FONT_NAME size:(IS_IPHONE_4_4s||IS_IPHONE_5_5s_5c)?(A-1):((IS_IPHONE_6p_6sp_7p_8p)?(A+1):A)]

#define IS_IPHONE_X \
({BOOL isPhoneX = NO;\
if (@available(iOS 11.0, *)) {\
isPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\
}\
(isPhoneX);})

#define IS_IPHONE_4_4s ((BOUNDHEIGHT == 480.0f) ? YES : NO)
#define IS_IPHONE_5_5s_5c ((BOUNDHEIGHT == 568.0f) ? YES : NO)
#define IS_IPHONE_6_6s_7_8 ((BOUNDHEIGHT == 667.0f) ? YES : NO)
#define IS_IPHONE_6p_6sp_7p_8p ((BOUNDHEIGHT == 736.0f) ? YES : NO)

//UIFONT ----------------------------------------------
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000
#define NORMAL_FONT_NAME @"HelveticaNeue"
#define BLOD_FONT_NAME @"HelveticaNeue-Bold"
#elif
#define NORMAL_FONT_NAME @"PingFang-SC-Medium"
#define BLOD_FONT_NAME @"PingFangSC-Semibold"
#endif

#endif /* Define_h */
